|
RAIS
3.2
|
00001 using System; 00002 using System.Collections.Generic; 00003 using System.Text; 00004 using NUnit.Framework; 00005 using RAIS.Common.TableManagement; 00006 using RAIS.DataAccessLayer; 00007 00008 namespace RAIS.DataAccessLayerTest.CommonClasses 00009 { 00010 [TestFixture] 00011 public class TableTest 00012 { 00013 Table.TableTypeData tableTypeData; 00014 00015 [SetUp] 00016 public void Init() 00017 { 00018 // The tableTypesDictionary field is initialized in TableManagement 00019 // static constructor, so, create new TableManagement object to 00020 // initialize tableTypesDictionary field. 00021 TableManagement tableManagement = new TableManagement(); 00022 00023 this.tableTypeData = new Table.TableTypeData(); 00024 } 00025 [Test] 00026 public void TableTypesDictionary_Count() 00027 { 00028 // Preparations 00029 int expectedCount = 3; 00030 00031 // Test 00032 Assert.AreEqual(expectedCount, Table.TableTypesDictionary.Count); 00033 } 00034 [Test] 00035 public void TableTypesDictionary_Single() 00036 { 00037 // Preparations 00038 int expectedID = 1; 00039 Table.TableType expectedType = Table.TableType.Single; 00040 string expectedVisibleName = "Single"; 00041 00042 // Test 00043 this.tableTypeData = Table.TableTypesDictionary[expectedVisibleName]; 00044 00045 // Checks 00046 Assert.AreEqual(expectedID, this.tableTypeData.ID); 00047 Assert.AreEqual(expectedType, this.tableTypeData.Type); 00048 Assert.AreEqual(expectedVisibleName, this.tableTypeData.VisibleName); 00049 } 00050 [Test] 00051 public void TableTypesDictionary_WithHistory() 00052 { 00053 // Preparations 00054 int expectedID = 2; 00055 Table.TableType expectedType = Table.TableType.WithHistory; 00056 string expectedVisibleName = "With History"; 00057 00058 // Test 00059 this.tableTypeData = Table.TableTypesDictionary[expectedVisibleName]; 00060 00061 // Checks 00062 Assert.AreEqual(expectedID, this.tableTypeData.ID); 00063 Assert.AreEqual(expectedType, this.tableTypeData.Type); 00064 Assert.AreEqual(expectedVisibleName, this.tableTypeData.VisibleName); 00065 } 00066 [Test] 00067 public void TableTypesDictionary_Authorization() 00068 { 00069 // Preparations 00070 int expectedID = 3; 00071 Table.TableType expectedType = Table.TableType.Authorization; 00072 string expectedVisibleName = "Authorization"; 00073 00074 // Test 00075 this.tableTypeData = Table.TableTypesDictionary[expectedVisibleName]; 00076 00077 // Checks 00078 Assert.AreEqual(expectedID, this.tableTypeData.ID); 00079 Assert.AreEqual(expectedType, this.tableTypeData.Type); 00080 Assert.AreEqual(expectedVisibleName, this.tableTypeData.VisibleName); 00081 } 00082 } 00083 }